import { Router } from 'express';
import { UploadController } from '../controllers/uploadController';
import { uploadImage, uploadMultipleImages, uploadVideo, handleUploadError } from '../middleware/upload';
import { authenticate } from '../middleware/auth';

const router = Router();
const uploadController = new UploadController();

/**
 * @swagger
 * tags:
 *   name: Upload
 *   description: 文件上传管理
 */

// 上传单张图片
router.post('/image', 
  authenticate, 
  uploadImage, 
  handleUploadError, 
  uploadController.uploadSingleImage
);

// 上传多张图片
router.post('/images', 
  authenticate, 
  uploadMultipleImages, 
  handleUploadError, 
  uploadController.uploadMultipleImages
);

// 上传视频
router.post('/video', 
  authenticate, 
  uploadVideo, 
  handleUploadError, 
  uploadController.uploadVideo
);

// 删除文件
router.delete('/delete', 
  authenticate, 
  uploadController.deleteFile
);

// 获取上传配置信息
router.get('/info', 
  uploadController.getUploadInfo
);

export default router;